import request from '@/utils/request'

export const getAllMenus = () => {
  return request({
    method: 'GET',
    url: '/boss/menu/getAll',
  })
}

export const saveOrUpdate = data => {
  return request({
    method: 'POST',
    url: '/boss/menu/saveOrUpdate',
    data,
  })
}

export const deleteMenu = id => {
  return request({
    method: 'DELETE',
    url: `/boss/menu/${id}`,
  })
}

export const getEditMenuInfo = id => {
  return request({
    method: 'GET',
    url: `/boss/menu/getEditMenuInfo?id=${id}`,
  })
}

export const getMenuNodeList = () => {
  return request({
    method: 'GET',
    url: `/boss/menu/getMenuNodeList`,
  })
}

export const allocateRoleMenus = data => {
  return request({
    method: 'POST',
    url: '/boss/menu/allocateRoleMenus',
    data,
  })
}

export const getRoleMenus = roleId => {
  return request({
    method: 'GET',
    url: `boss/menu/getRoleMenus`,
    params: {
      roleId,
    }
  })
}
